home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / mlib / include / mkey.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-27  |  1.9 KB  |  60 lines

  1. ////////////////////////////////////////////////////////////////////////////
  2. // MKEY.H
  3. //
  4. // header file for MKey;
  5. ////////////////////////////////////////////////////////////////////////////
  6.  
  7. #ifndef __MKEY_H
  8. #define __MKEY_H
  9.  
  10. #include <conio.h>
  11.  
  12. #define MKEY_ID              0x0110
  13.  
  14.        /* Several general defines  */
  15.  
  16. #define ENTER                13
  17. #define ESCAPE               27
  18. #define BACKSPACE            8
  19. #define SPACE                32
  20. #define UPARROW              328
  21. #define DOWNARROW            336
  22. #define RIGHTARROW           333
  23. #define LEFTARROW            331
  24. #define TAB                  15
  25.  
  26. #define N_KEYS               512          // Two independent bytes
  27.  
  28. #define DEFAULT_KEY_REP_DELAY    0
  29.  
  30. class MKey : public bArray {
  31. public:
  32.     enum                     keyLabel {Escape = 27, Enter = 13, num1 = 49,
  33.                        num2, num3, num4, num5, num6, num7,
  34.                        num8, num9, num0, tab=15, charQ,
  35.                        charW, charE, charR, charT, charY,
  36.                        charU, charI, charO, charP, charA=30,
  37.                        charS, charD, charF, charG, charH,
  38.                        charJ, charK, charL, charZ=44,
  39.                        charX, charC, charV, charB, charN,
  40.                        charM, keyComma, keyDot, SpaceBar=32,
  41.                        UpArrow=(256+72), DownArrow=(256+80),
  42.                        LeftArrow=(256+75), RightArrow=(256+77)};
  43.     DWORD                    RepeatDelay;
  44. public:
  45.                  MKey (void);
  46.     virtual inline classType isA (void) {return (MKEY_ID);};
  47.     void                     KeyFlush (void);
  48.     inline BOOL              KeyPress (void) { return (kbhit());};
  49.     inline void              SetRepeatDelay (DWORD NewDelay) { RepeatDelay = NewDelay;};
  50.     WORD                     GetKey (void);
  51.     void                     WaitCr (void);
  52.     WORD                     Update (void);
  53.                 ~MKey (void);
  54. };
  55.  
  56. #ifndef MKEY_UNIT
  57. extern MKey keyb;
  58. #endif
  59. #endif
  60.